#!/usr/bin/python

# Copyright 2009, Fei Yu, feiyu [at] berkeley [dot] edu

# This file is part of Topics-Portal.
#
# Topics-Portal is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Topics-Portal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PyGrams.  If not, see <http://www.gnu.org/licenses/>.

from django.conf.urls.defaults import *
from django.conf import settings
# from django.contrib import admin
# from django.contrib.sitemaps import GenericSitemap
from couchdbkit import *


# infoDict = {
#     'queryset': Topic.objects.all(),
# }
# 
# sitemaps = {
#     'topics': GenericSitemap(infoDict),
# }

urlpatterns = patterns('',
    # (r'^admin/(.*)', admin.site.root),                       
    # (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap',
    #     {'sitemaps': sitemaps}),
    (r'^topics/(?P<topicName>.+)/$', 'ims.sti.views.topic'),
    (r'^topics/$', 'ims.sti.views.topicIndex'),
    (r'^persons/$', 'ims.sti.views.personIndex'),
    (r'^$', 'ims.sti.views.home'),
    (r'^search/$', 'ims.sti.views.search'),
    (r'^courses/$', 'ims.sti.views.courseIndex'),
    (r'^courses/(?P<courseName>[^/]+)/$', 'ims.sti.views.course'),
    (r'^courses/(?P<courseName>[^/]+)/(?P<choice>[^/]+)/$', 'ims.sti.views.course'),
    (r'^redirect/(?P<ext_url>.+)/$','ims.sti.views.redirect'),
	(r'^books/$', 'ims.sti.views.bookIndex'),
	(r'^books/(?P<bookName>.+)/$', 'ims.sti.views.book'),
	(r'^about/$', 'ims.sti.views.about')


)

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^(?P<path>(stylesheets|images)/.*)$', 
            'django.views.static.serve', 
            {'document_root': '/home/www-data/www/static'}),)

